package view;

import actor.Actor;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;

public class RoundTurns extends JComponent {
    private ImageIcon imageIcon;
    private JLabel imageLabel;
    private JLabel nameLabel;
    private Border line = BorderFactory.createLineBorder(Color.BLACK, 2);

    public RoundTurns(Actor actor) {
        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        String fileName = "src/image/" + actor.getImage() + ".png";
        imageIcon = new ImageIcon(fileName);
        imageLabel = new JLabel(imageIcon);
        nameLabel = new JLabel(actor.getName());
        nameLabel.setBounds(33, 1, 40, 30);
        imageIcon.setImage(imageIcon.getImage().getScaledInstance(30, 30, Image.SCALE_DEFAULT));
        imageLabel.setBounds(1, 1, 30, 30);
        imageLabel.setBorder(line);
        add(imageLabel);
        add(nameLabel);
        setPreferredSize(new Dimension(120, 40));
    }


}
